package components.iteminfo
{
	import capricornus.components.window.FrameWindow;
	import capricornus.components.window.WindowAlignType;
	import capricornus.core.StageManager;
	
	import components.map.item.SceneItem;
	
	import flash.display.DisplayObjectContainer;
	import flash.display.Sprite;
	import flash.text.TextField;
	
	public class InfoBar extends FrameWindow
	{
		private var _txtX:TextField;
		private var _txtY:TextField;
		
		public function InfoBar(owner:DisplayObjectContainer)
		{
			super(owner);
		}
		
		override protected function set panel(value:Sprite):void
		{
			super.panel = value;
			_txtX = panel.getChildByName("txtx") as TextField;
			_txtY = panel.getChildByName("txty") as TextField;
			
			setCenterLocation();
			setLocation( StageManager.stageWidth - this.width, this.y );
			setAlignType( WindowAlignType.RIGHT, WindowAlignType.TOP );
		}
		
		public function setRelateTarget( item:SceneItem ):void
		{
			_txtX.text = item.x.toString();
			_txtY.text = item.y.toString();
		}
	}
}